package Vehicle;

import java.util.Scanner;

public class Test {
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		/*
		 * 让用户输入，使用汽车租赁系统
		 */
		Scanner scanner = new Scanner(System.in);
		//调用汽车租赁系统
		VehicleBusiness vb = new VehicleBusiness();
		//初始化汽车数组
		vb.init();
		String brand = null;
		String model=null;
		int seat=0;
		
		System.out.println("********欢迎登陆汽车租赁系统！********");
		System.out.println("当前可租赁的汽车种类有：\n1.轿车\t2.客车");
		int choice= scanner.nextInt();
		
		if(choice==1) {
			System.out.println("您选择了租赁轿车！");
			System.out.println("请选择您要租赁的轿车品牌：\n1.凯迪拉克\t2.奔驰\t3.特斯拉\t4.玛莎拉蒂");
			int num=scanner.nextInt();
			switch (num) {
			case 1:
				brand="凯迪拉克";
				System.out.println("请选择"+brand+"的型号：\n1.XT4\t2.XT5\t3.XT6");
				int num1=scanner.nextInt();
				if(num1==1) {
					model="XT4";
				}else if (num1==2) {
					model="XT5";
				}else {
					model="XT6";
				}
				break;
			case 2:
				brand="奔驰";
				System.out.println("请选择"+brand+"的型号：\n1.GLC\t2.E206L\t3.S350L");
				int num2=scanner.nextInt();
				if(num2==1) {
					model="GLC";
				}else if (num2==2) {
					model="E206L";
				}else {
					model="S350L";
				}
				break;
			case 3:
				brand="特斯拉";
				System.out.println("请选择"+brand+"的型号：\n1.Model 3\t2.Model X\t3.Model S");
				int num3=scanner.nextInt();
				if(num3==1) {
					model="Model 3";
				}else if (num3==2) {
					model="Model X";
				}else {
					model="Model S";
				}
				break;
			case 4:
				brand="玛莎拉蒂";
				System.out.println("请选择"+brand+"的型号：\n1.Ghibli 3\t2.Levante\t3.总裁");
				int num4=scanner.nextInt();
				if(num4==1) {
					model="Ghibli";
				}else if (num4==2) {
					model="Levante";
				}else {
					model="总裁";
				}
				break;
			default:
				System.out.println("输入错误，请重新输入！");
				break;
			}
			
		}else {
			System.out.println("您选择了租赁客车！");
			System.out.println("请选择您要租赁的客车品牌：\n1.金龙\t2.考斯特");
			brand=scanner.nextInt()==1?"金龙":"考斯特";
			if(brand.equals("")) {
				System.out.println("请选择"+brand+"的座位数：\n1.53\t2.45");
				seat=scanner.nextInt()==1?53:45;
			}else {
				System.out.println("请选择"+brand+"的座位数：\n1.22\t2.37");
				seat=scanner.nextInt()==1?22:37;
			}
		}
		
		//根据用户输入信息返回所需要的汽车
		//调用汽车租赁方法
		Vehicle vehicle = vb.leaseOut(brand, model, seat);
		
		//让用户输入需要租用的天数，计算租金
		System.out.println("请输入您要租赁的天数：");
		int days=scanner.nextInt();
		//计算租金
		double rent=vehicle.calcRent(days);
		System.out.println("您的租赁费用为："+rent);
		System.out.println("恭喜您租车成功！");
		//输出租车信息
		System.out.println(vehicle.toString());
		
	}
}
